package cn.bocweb.spinning.view.dialog;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.Button;

import cn.bocweb.spinning.R;

/**
 * Created by chenchangxing on 15/12/22.
 */
public class MyDialog extends AlertDialog {

    Activity activity;

    public void setOnClickListener(OnClickListener onClickListener) {
        this.onClickListener = onClickListener;
    }

    OnClickListener onClickListener;

    public interface OnClickListener {
        public void click();
    }

    public MyDialog(Activity activity) {
        super(activity);
        this.activity = activity;
    }

    public MyDialog(Activity activity, int themeResId) {
        super(activity, themeResId);
        this.activity = activity;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_my);
        Button btn = (Button)findViewById(R.id.my_dialog_btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickListener.click();
            }
        });
    }
}
